/*
 * 
 */
package com.china08.yxyapi.repository.mg.moments;

import java.util.List;

import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.mongodb.repository.MongoRepository;

import com.china08.yxyapi.entity.mg.moments.YxyMomentsComment;

/**
 * 班级圈评论,每一个班级圈的每一个评论存储一条记录
 * 
 * @author Richard.Wang
 */
public interface YxyMomentsCommentRepository extends MongoRepository<YxyMomentsComment, String> {

    List<YxyMomentsComment> findFirst10ByMomentsIdOrderByCreatedDate(String momentsId);

    YxyMomentsComment findById(String id);

    @Query(value = "select t from YxyMomentsComment where momentsId = ?1 order by createdDate desc ")
    List<YxyMomentsComment> findByMomentsId(String id);

    void deleteByIdAndUserId(String id, String userId);

    YxyMomentsComment findByIdAndUserId(String id, String userId);

    Integer countByMomentsId(String momentsId);

    Long countByMomentsIdIn(List<String> ids);

}
